<template>
  <!-- hvps141明细-->
  <el-dialog
    title="即时转账业务回执审核明细"
    center
    :visible.sync="openState"
    width="1024px"
    :close-on-click-modal="false"
  >
    <el-form ref="queryDetailForm141" :model="form" label-width="130px" disabled>
      <!--交易础信息-->
      <el-card class="form-card txnInfo-card">
        <div slot="header" class="label-header-msg">
          <span>回执审核基本信息</span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="系统流水号" prop="id">
              <el-input v-model="form.id" placeholder="系统流水号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报文类型" prop="pkgNo">
              <el-select v-model="form.pkgNo" placeholder="报文类型">
                <el-option
                  v-for="dict in dictMap.PKG_TYPE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="工作日期" prop="workdate">
              <el-date-picker
                v-model="form.workdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="工作日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="CPG日期" prop="cpgdate">
              <el-date-picker
                v-model="form.cpgdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="CPG日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="来往账标志" prop="drct">
              <el-select v-model="form.drct" placeholder="来往账标志">
                <el-option
                  v-for="dict in dictMap.DRCTCODE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="系统编码" prop="sysCode">
              <el-select v-model="form.sysCode" placeholder="系统编码">
                <el-option
                  v-for="dict in dictMap.SYS_CODE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="回执明细成功总笔数" prop="successNum">
              <el-input v-model="form.successNum" placeholder="回执明细成功总笔数" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="回执明细成功总金额" prop="successAmount">
              <el-input v-model="form.successAmount" placeholder="回执明细成功总金额" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="直接发起参与者" prop="directSender">
              <el-input v-model="form.directSender" placeholder="直接发起参与者" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="直接发起参与者名称" prop="directSendername">
              <el-input v-model="form.directSendername" placeholder="直接发起参与者名称" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <el-card class="form-card txnInfo-card">
        <div slot="header" class="label-header-msg">
          <span>原即时转账业务信息</span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="原报文流水号" prop="oriId">
              <el-input v-model="form.oriId" placeholder="原报文流水号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="原报文标识号" prop="oriPkgId">
              <el-input v-model="form.oriPkgId" placeholder="原报文标识号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="原报文类型" prop="oriPkgNo">
              <el-select v-model="form.oriPkgNo" placeholder="原报文类型">
                <el-option
                  v-for="dict in dictMap.PKG_TYPE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="原明细标识号" prop="oriTxnId">
              <el-input v-model="form.oriTxnId" placeholder="原明细标识号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="内部机构号" prop="brno">
              <el-input v-model="form.brno" placeholder="内部机构号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="三方协议号" prop="threeId">
              <el-input v-model="form.threeId" placeholder="三方协议号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="业务类型" prop="bizTypeCode">
              <el-select v-model="form.bizTypeCode" placeholder="业务类型">
                <el-option
                  v-for="dict in dictMap.BIZ_TYPE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="业务种类" prop="bizCtgyCode">
              <el-select v-model="form.bizCtgyCode" placeholder="业务种类">
                <el-option
                  v-for="dict in  dictMap.BIZ_CTGY"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="借贷标识" prop="cdIndicator">
              <el-select v-model="form.cdIndicator" placeholder="借贷标识">
                <el-option
                  v-for="dict in dictMap.CREDITDEBITCODE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="清算日期" prop="clrDate">
              <el-date-picker
                v-model="form.clrDate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="清算日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="特许参与者" prop="espOrg">
              <el-input v-model="form.espOrg" placeholder="特许参与者" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="特许参与者名称" prop="espOrgName">
              <el-input v-model="form.espOrgName" placeholder="特许参与者名称" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <!--付款人信息-->
      <el-card class="form-card payerInfo-card">
        <div slot="header" class="label-header-msg">
          <span>付款人信息</span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="付款人账号" prop="payerActno">
              <el-input v-model="form.payerActno" placeholder="付款人账号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款人名称" prop="payerName">
              <el-input v-model="form.payerName" placeholder="付款人名称" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <div class="grid-payer">
              <el-form-item label="付款行行号" prop="payerBrno">
                <el-input v-model="form.payerBrno" placeholder="付款行行号" />
              </el-form-item>
            </div>
          </el-col>

          <el-col :span="12">
            <el-form-item label="付款行行名" prop="payerBrname">
              <el-input v-model="form.payerBrname" placeholder="付款行行名" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <div class="grid-payer">
              <el-form-item label="付款人开户行号" prop="payerAccBrno">
                <el-input v-model="form.payerAccBrno" placeholder="付款人开户行行号" />
              </el-form-item>
            </div>
          </el-col>

          <el-col :span="12">
            <el-form-item label="付款人开户行行名" prop="payerAccBrname">
              <el-input v-model="form.payerAccBrname" placeholder="付款人开户行行名" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <!--收款人信息-->
      <el-card class="form-card payeeInfo-card">
        <div slot="header" class="label-header-msg">
          <span>收款人信息</span>
        </div>
        <el-row>
          <el-col :span="12">
            <div class="grid-payee">
              <el-form-item label="收款人账号" prop="payeeActno">
                <el-input v-model="form.payeeActno" placeholder="收款人账号" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="12">
            <el-form-item label="收款人名称" prop="payeeName">
              <el-input v-model="form.payeeName" placeholder="收款人名称" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <div class="grid-payee">
              <el-form-item label="收款行行号" prop="payeeBrno">
                <el-input v-model="form.payeeBrno" placeholder="收款行行号" :readonly="form.bizTypeCode === 'A202'" />
              </el-form-item>
            </div>
          </el-col>

          <el-col :span="12">
            <el-form-item label="收款行行名" prop="payeeBrname">
              <el-input v-model="form.payeeBrname" placeholder="收款行行名" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <div class="grid-payee">
              <el-form-item label="收款人开户行号" prop="payeeAccBrno">
                <el-input v-model="form.payeeAccBrno" placeholder="收款人开户行行号" />
              </el-form-item>
            </div>
          </el-col>

          <el-col :span="12">
            <el-form-item label="收款人开户行行名" prop="payeeAccBrname">
              <el-input v-model="form.payeeAccBrname" placeholder="收款人开户行行名" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <!--其他信息-->
      <el-card class="form-card payOtherInfo-card">
        <div slot="header" class="label-header-msg">
          <span>其他交易信息</span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="交易货币" prop="curcd">
              <el-input v-model="form.curcd" placeholder="交易货币" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="金额" prop="amount">
              <el-input v-model="form.amount" placeholder="金额" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="中心状态" prop="procStatus">
              <el-select v-model="form.procStatus" placeholder="中心状态" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.PROCESSSTATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="通讯状态" prop="comStatus">
              <el-select v-model="form.comStatus" placeholder="通讯状态" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.PKG_STATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注" prop="content">
              <el-input type="textarea" v-model="form.content" placeholder="备注" maxlength="210" show-word-limit />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
    </el-form>
    <el-form ref="queryDetailForm141" :model="form" label-width="130px">
      <!--回执状态信息-->
      <el-card class="form-card payOtherInfo-card">
        <div slot="header" class="label-header-msg">
          <span>回执状态信息</span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="业务回执状态" prop="returnStatus">
              <el-select v-model="form.returnStatus" disabled placeholder="业务回执状态">
                <el-option
                  v-for="dict in dictMap.BIZRT_STATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="业务回执码" prop="returnCode">
              <el-input v-model="form.returnCode" placeholder="业务回执码" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="业务拒绝信息" prop="returnInfo">
              <el-input v-model="form.returnInfo" placeholder="业务拒绝信息" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="业务状态" prop="status">
              <el-select v-model="form.status" disabled placeholder="业务状态">
                <el-option
                  v-for="dict in dictMap.TXN_STATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="中心状态" prop="procStatus">
              <el-select v-model="form.procStatus" disabled placeholder="中心状态">
                <el-option
                  v-for="dict in dictMap.PROCESSSTATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row></el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="业务处理码" prop="procCode">
              <el-input v-model="form.procCode" placeholder="业务处理码" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="业务处理信息" prop="procInfo">
              <el-input v-model="form.procInfo" placeholder="业务处理信息" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="录入操作员" prop="mdTlrno">
              <el-input v-model="form.mdTlrno" placeholder="录入操作员" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="录入时间" prop="mdTime">
              <el-date-picker
                v-model="form.mdTime"
                disabled
                type="datetime"
                value-format="yyyyMMddHHmmss"
                placeholder="录入时间"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- <el-row>
          <el-col :span="12">
            <el-form-item label="审核操作员" prop="returnAudTlrno">
              <el-input v-model="form.returnAudTlrno" placeholder="审核操作员" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="审核时间" prop="returnAudTime">
              <el-date-picker
                v-model="form.returnAudTime"
                type="datetime"
                value-format="yyyyMMddHHmmss"
                placeholder="审核时间"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>-->

        <el-row>
          <el-col :span="24">
            <div class="grid-otherInfo">
              <el-form-item label="审核附言" prop="audRemarks">
                <el-input type="textarea" v-model="form.audRemarks" placeholder="审核附言" maxlength="128" show-word-limit />
              </el-form-item>
            </div>
          </el-col>
        </el-row>
      </el-card>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="approveFn" :loading="isLoading">审 核</el-button>
      <el-button type="danger" @click="rejectFn" :loading="isLoading">拒 绝</el-button>
      <el-button @click="handleClose">关 闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { approve3, reject3 } from "@/api/cnaps/baseBiz/send/check/creditCheck";
import HtAmountInput from "@/views/components/HtAmountInput";
import HtAmountUpper from "@/views/components/HtAmountUpper";
import QueryDetailInterInfo from "@/views/cnaps/baseBiz/send/components/queryDetailInterInfo";
import ClearAccountQuery from "@/views/cnaps/saps/otherCommQuery/352/clear_account_query";

export default {
  name: "QueryDetailDialog",
  components: {
    ClearAccountQuery,
    HtAmountInput,
    HtAmountUpper,
    QueryDetailInterInfo,
  },
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    form: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      busTypeList: [],
      id: "",
      pkgNo: "",
      isLoading: false,
      // 是否显示弹出层
      openState: false,
      rules: {
        returnStatus: [{ required: true, message: "请输入回执状态", trigger: "blur" }],
      },
    };
  },
  mounted() {},
  methods: {
    show() {
      this.openState = true;
    },
    // 关闭回掉
    handleClose() {
      this.openState = false;
    },
    // 表单重置
    reset() {
      this.resetForm("editForm");
      this.$set(this, "form", {});
    },
    cancel() {
      this.openState = false;
      this.reset();
      this.$emit("editComplete", false);
    },
    /** TODO提交按钮 */
    approveFn: function () {
      this.isLoading = true;
      //如果有ID 则是修改
      //this.form.userInfo = { brno: "676", userId: "cpg001" };
      approve3(this.form).then((res) => {
        this.isLoading = false;
        this.msgSuccess("审核成功");
        this.$emit("editComplete", true);
        this.openState = false;
        this.resetForm("queryDetailForm141");
      }).catch(error => {
        this.isLoading = false;
      });
    },
    rejectFn: function () {
      this.isLoading = true;
      //如果有ID 则是修改
      //this.form.userInfo = { brno: "676", userId: "cpg001" };
      reject3(this.form).then((res) => {
        this.isLoading = false;
        this.msgSuccess("拒绝成功");
        this.$emit("editComplete", true);
        this.openState = false;
        this.resetForm("queryDetailForm141");
      }).catch(error => {
        this.isLoading = false;
      });
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
